Skip to content

refactor(transport): explicitly specify UTF-8 charset when creating InputStreamReader#717

Open
codeboyzhou wants to merge 5 commits intomodelcontextprotocol:mainfrom
codeboyzhou:polish-2
Open

refactor(transport): explicitly specify UTF-8 charset when creating InputStreamReader#717
codeboyzhou wants to merge 5 commits intomodelcontextprotocol:mainfrom
codeboyzhou:polish-2

Conversation

@codeboyzhou
Copy link
Contributor

@codeboyzhou codeboyzhou commented Dec 11, 2025

Explicitly specify UTF-8 charset when creating InputStreamReader instances.

Motivation and Context

(SpotBugs check) Ensure consistent character encoding to avoid potential problem.

How Has This Been Tested?

Just run ./mvnw test

Breaking Changes

Not involved

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Not involved

…readers

Make scheduler fields final in client and server transports for better immutability.
Explicitly specify UTF-8 charset when creating InputStreamReader instances to ensure consistent character encoding.
@chemicL
Copy link
Member

chemicL commented Mar 2, 2026

Hi, thanks for the proposed change. Can you please look at #826 and also propose a test that validates the changes work as expected?

@chemicL chemicL added the waiting for user Waiting for user feedback or more details label Mar 2, 2026
Add test cases to verify proper UTF-8 character handling in StdioClientTransport when system default charset is not UTF-8. Includes a test echo server subprocess to simulate non-UTF-8 environment.
@codeboyzhou
Copy link
Contributor Author

Hi, thanks for the proposed change. Can you please look at #826 and also propose a test that validates the changes work as expected?

Ok, I have already supplemented and run the tests, the changes work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for user Waiting for user feedback or more details

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants